<html>
<head><meta charset="utf-8"><title>dyn X + &#x27;a isn&#x27;t well-formed · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/dyn.20X.20.2B.20&#x27;a.20isn&#x27;t.20well-formed.html">dyn X + &#x27;a isn&#x27;t well-formed</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="209903718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/dyn%20X%20%2B%20%27a%20isn%27t%20well-formed/near/209903718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> David Ross <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/dyn.20X.20.2B.20&#x27;a.20isn&#x27;t.20well-formed.html#209903718">(Sep 12 2020 at 23:02)</a>:</h4>
<p>Quick question: do we expect this to pass? If so, what feature is missing here?</p>
<div class="codehilite"><pre><span></span><code>trait X {}
forall&lt;&#39;a&gt; { WellFormed(dyn X + &#39;a) }
</code></pre></div>


<p><span class="user-mention" data-user-id="271698">@Super Tuple</span> and I are running into this failing while working on a variance test case (<code>type-infer-generalize-ty-var.rs</code> from rustc), but it doesn't seem directly variance related.</p>



<a name="209915087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/dyn%20X%20%2B%20%27a%20isn%27t%20well-formed/near/209915087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/dyn.20X.20.2B.20&#x27;a.20isn&#x27;t.20well-formed.html#209915087">(Sep 13 2020 at 05:38)</a>:</h4>
<p>Right now there are no clauses about well-formedness of trait objects (see <a href="https://github.com/rust-lang/chalk/blob/404bc7efed43beae5461a0acc3fe54948d124eca/chalk-solve/src/clauses.rs#L601">this</a>)</p>



<a name="209915257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/dyn%20X%20%2B%20%27a%20isn%27t%20well-formed/near/209915257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/dyn.20X.20.2B.20&#x27;a.20isn&#x27;t.20well-formed.html#209915257">(Sep 13 2020 at 05:44)</a>:</h4>
<p>I don't think we came to consensus as to whether we expect this to be provable?</p>



<a name="209915270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/dyn%20X%20%2B%20%27a%20isn%27t%20well-formed/near/209915270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/dyn.20X.20.2B.20&#x27;a.20isn&#x27;t.20well-formed.html#209915270">(Sep 13 2020 at 05:45)</a>:</h4>
<p>It's (I think) the same question as "should <code>WellFormed( ([u32], [u32]) )</code> be provable" (right now it is, all tuples are considered well formed)</p>



<a name="210059984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/dyn%20X%20%2B%20%27a%20isn%27t%20well-formed/near/210059984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/dyn.20X.20.2B.20&#x27;a.20isn&#x27;t.20well-formed.html#210059984">(Sep 14 2020 at 20:38)</a>:</h4>
<p>We should look at the rules rustc uses; there are definitely some rules</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>